$(() => {
    $(".editMember").click(function () {
        $("#personalInfoModal").modal('show'); // 显示模态框
    });

    $("#saveButton").click(function (){
        // console.log("aaaaaaaaaaaa")
        let id =$(this).data("id");
        let name =$("#nickName").val();
        let description =$("#description").val();
        let addressDetail =$("#addressDetail").val();
        let phone = $("#phone").val();
        $.ajax({
            url:ctx+"update",
            method: "post",
            data:{
                id:id,
                name:name,
                description:description,
                addressDetail:addressDetail,
                phone:phone,
            },
            success: function (resp) {
                console.log(resp);
                if (resp.code == 200) {
                    $('#personalInfoModal').modal('hide');
                    // session里面的姓名也要修改
                    //重新加载首页的session.name
                    window.location.reload();
                } else {
                    $('#personalInfoModal').modal('hide');
                    alert(resp.msg);
                }
                ;
            },
            error: function () {
                Swal.fire({
                    text: '操作失败',
                    icon: "error",iconColor:"#f05b72",
                });
            }
        });
    });
});